package com.shoplink.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.EditText;

public class SoftkeyboardListenEditText extends EditText {
	
	public interface DoKeyBackListener{
		public void doKeyBack();
	}
	private DoKeyBackListener doKeyBackListener;
	public void setDoKeyBackListener(DoKeyBackListener doKeyBackListener){
		this.doKeyBackListener = doKeyBackListener;
	}
	
	public SoftkeyboardListenEditText(Context context) {
		 
		super(context);
		// TODO Auto-generated constructor stub
	}

	public SoftkeyboardListenEditText(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean dispatchKeyEventPreIme(KeyEvent event) {
	    if(doKeyBackListener != null && event.getKeyCode() == 4){
	    	doKeyBackListener.doKeyBack();
	    }
		return super.dispatchKeyEventPreIme(event);
	}

}
